package com.jrx.anytxn.transaction.job.paph.step;

import com.jrx.anytxn.param.entity.PrOrganizationTable;
import com.jrx.anytxn.param.service.system.IOrganizationTableService;
import com.jrx.anytxn.transaction.constant.TransBizConstant;
import com.jrx.anytxn.transaction.mapper.ext.ExtTlServiceFeeLogMapper;
import com.jrx.anytxn.transaction.mapper.ext.ExtTlThirdPartyPaymentMapper;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @program: anytxn-cf-parent
 * @description:
 * @author: xiaoyu.jing
 * @date: 2021-03-15 10:13
 **/
@Service
public class DealServiceFeeListener implements JobExecutionListener {

    @Resource
    private ExtTlServiceFeeLogMapper extTlServiceFeeLogMapper;
    @Autowired
    private IOrganizationTableService organizationTableService;

    @Override
    public void beforeJob(JobExecution jobExecution) {
        //删除掉当日生成的费用数据
        PrOrganizationTable org = organizationTableService.findByOrgIdForBatch(TransBizConstant.DEFAULT_ORG_ID);
        Date today = org.getToday();
        extTlServiceFeeLogMapper.deleteByDate(today);
    }

    @Override
    public void afterJob(JobExecution jobExecution) {

    }
}
